/**
 * 物联卡 GPRS（自主）限速详情对话框
 */

layui.use(['layer', 'form', 'admin', 'ax'], function () {
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;

    form.verify({
        cardNum: [/^[0-9a-zA-Z]{1,64}$/, "请输入不超过64个英文或数字字符"],
        apnName: [/^[\S]{1,32}$/, "请输入不超过32个字符"]
    });

    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/simInfoForGprs/gprsLimitSpeed", function (data) {
            layer.open({
                content: "限速成功！",
                skin: 'layui-layer-molv',
                yes: function (index, layero) {
                    admin.closeThisDialog();
                }
            });
        }, function (data) {
            layer.open({
                content: "限速失败！" + data.responseJSON.message,
                skin: 'layui-layer-molv',
                yes: function (index, layero) {
                    layer.close(index);
                }
            });
        });
        ajax.set(data.field);
        ajax.start();

        return false;
    });

});